import React, { useState } from "react";
import { StyleSheet, Text, View } from "react-native";
import StarRating from "react-native-star-rating";

const LabelStarRating = ({label, style,disabled=false,star=2,selectedStar}) => {
  // const [startCount, setStartCount] = useState(star);
  return (
    <View style={[{flexDirection: 'row', alignItems: 'center'}, {...style}]}>
      <Text style={styles.text}>{label}</Text>
      <StarRating
        containerStyle={{marginLeft: 10}}
        buttonStyle={{marginRight: 10}}
        starSize={14}
        maxStars={5}
        disabled={disabled}
        rating={star}
        fullStarColor={'#F7BA2A'}
        selectedStar={rating => {
          // setStartCount(rating);
          selectedStar&&selectedStar(rating)
        }}
      />
    </View>
  );
};

export default LabelStarRating;

const styles = StyleSheet.create({
  text: {
    fontSize: 12,
    color: '#666666',
  },
});
